/*
 * lcd12864_2.h
 *
 *  Created on: 2012-6-27
 *      Author: Administrator
 */

#ifndef LCD12864_2_H_
#define LCD12864_2_H_

#define _FACE_FACTORY 0
#define _FACE_TIP_FACE 1
#define _FACE_SOLD_OUT 2
#define _FACE_SLOT_FAULT 3
#define _FACE_INVALID_SLOT 4
#define _FACE_SELECT_GOODS 5

#define _FACE_FAIL_TO_TRANS 6

#define _FACE_FAIL_TO_PAY 7
#define _FACE_SUCCESS_TO_PAY 8
#define _FACE_OUT_OF_SERVICE 9

#define _FACE_MENU 10

#define _FACE_SET_CAPACITY 11
#define _FACE_TEST_SLOT 12
#define _FACE_UPDATE_SUCCESS 13

#define _FACE_CHK_IR_OK 14
#define _FACE_CHK_IR 15

#define _FACE_UPDATE_CONFIRM 16

#define WIDTH 0
#define HEIGHT 1

#define LCD_MAX_X 128
#define LCD_MAX_Y 64

typedef enum
{
    FONT_8 = 0,
    FONT_10,
    FONT_12,
    FONT_16,
    FONT_20,
    FONT_24,
    FONT_UNKOWN = 0xff
} FONTNUM;

typedef enum
{
    V_NO_LIMIT = 0,
    V_LEFT,
    V_CENTER,
    V_RIGHT
} V_ALIGN_METHOD;
typedef enum
{
    H_NO_LIMIT = 0,
    H_TOP,
    H_MIDDLE,
    H_BOTTOM
} H_ALIGN_METHOD;

#define _TIP_FAULT_SLOT (0)
#define _TIP_NO_STOCK (_TIP_FAULT_SLOT + 96 * 48 / 8 + 2)
#define _TIP_INVALID_SLOT (_TIP_NO_STOCK + 96 * 48 / 8 + 2)
#define _TIP_SUCCESSFUL (_TIP_INVALID_SLOT + 96 * 48 / 8 + 2)
#define _TIP_FAILURE (_TIP_SUCCESSFUL + 96 * 48 / 8 + 2)

extern void Lcd_WriteDat(INT8U RW, INT8U RS, INT8U W_data);
extern void Lcd_WriteCmd(INT32U W_bits);
extern void Lcd_SetPos(INT8U y, INT8U x);

extern void img_disp(const INT8U *img);
extern void LCD_Init(void);
extern void Lcd_ShowFace(INT32U fid);
extern Err Lcd_ShowSwipe(INT32U price);
extern Err LCD_ShowTimer(INT32U time, INT32U x, INT32U y);

extern Err Lcd_ShowFailTip(INT32U fid, INT8U *tel);
extern Err Lcd_ShowOutOfService(Err e);

extern INT32U Lcd_ShowNumber(INT32U num, const INT8U *format);
extern void Lcd_DispLine(INT32U y, INT32U x, INT8U *p);

extern Err Lcd_ShowPrice(INT32U num, INT32U x, INT32U y, BOOLEAN backwight);

extern Err Lcd_ShowCredit(INT32U price);

extern INT32S LCD_ShowTips(INT8U *tip1, INT8U *tip2, INT8U *tip3, INT32S wait_time);

extern Err Lcd_ShowStringAlign(const INT8U *str, V_ALIGN_METHOD vali, H_ALIGN_METHOD hali);

extern INT32U Lcd_TestStringWidth(INT8U *str, FONTNUM font_size);

extern INT32U Lcd_TestCurrentStringHeight(INT32S lines);

extern Err Lcd_ShowErrMes(Err e);

extern Err Lcd_ShowString(const INT8U *str);
void DrawRectangle(pLocation loc1, pLocation loc2);

extern Err SetBackWhite(BOOLEAN);
extern void DelayByLoop(int n);

extern Err SetLocX(INT16U x);
extern Err SetLocY(INT16U y);
extern Err SetFont(FONTNUM font_size);
extern Err SetLocal(INT16U x, INT16U y);
extern void LCD_Clear(void);
extern void Lcd_ShowLogo(void);

extern void DrawRectangleByAx(INT32S x1, INT32S y1, INT32S x2, INT32S y2);

extern FONTNUM GetFont(void);

#endif /* LCD12864_2_H_ */
